import { Balances } from '@/lib/balances' import { cn } from '@/lib/utils' import { Participant } from '@prisma/client' type Props = { balances: Balances participants: Participant[] currency: string } export function BalancesList({ balances, participants, currency }: Props) { const maxBalance = Math.max( ...Object.values(balances).map((b) => Math.abs(b.total)), ) return (
{participants.map((participant) => { const balance = balances[participant.id]?.total ?? 0 const isLeft = balance >= 0 return (
{participant.name}
{currency} {(balance / 100).toFixed(2)}
{balance !== 0 && (
)}
) })}
) }